import { defineStore } from "pinia"
import { login, registered } from "@/api/login.js"
import { Getbalance} from "@/api/user.js"
export const userStore = defineStore(
    {
        id: "userStore",
        state: () => ({

        }),
        getters: () => ({

        }),
        actions: {
            login: (data) => {
                return new Promise((resolve, reject) => {
                    login(data).then(res => {
                        resolve(res)
                    })
                })
            },
            registered: (data) => {
                return new Promise((resolve, reject) => {
                    registered(data).then(res => {
                        resolve(res)
                    })
                })
            },
            Getbalance: (data) => {
                return new Promise((resolve, reject) => {
                    Getbalance(data).then(res => { 
                        resolve(res.data)
                    }).catch(err => { 
                        reject(err);
                    })
                 })
             }
        },

    }
)